import { useCallback, useState } from 'react';

export default () => {
  const [count, setCount] = useState<number>(0);

  //增
  const increment = useCallback(() => setCount((count) => count + 1), []);
  //减
  const decrement = useCallback(() => setCount((count) => count - 1), []);
  return {
    count,
    increment,
    decrement,
  };
};
